package com.demo.controller;

import com.demo.model.User;
import com.demo.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("user")
public class IndexController{
    @Resource
    UserService userService;

    @RequestMapping(value = "index")
    @ResponseBody
    public String index(){
        User user = userService.findUserById("1");
        return user.getName();
    }
}
